﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HNG.Portal.BLL;
using HNG.Portal.DAL;
using HNG.Portal.DAL.EntityClasses;
using HNG.Portal.DAL.FactoryClasses;
using HNG.Portal.DAL.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;
using HNG.LIB.Common;
using System.Data;
public partial class AdminPortal_Includes_ucHeader : System.Web.UI.UserControl
{
    TblThanhVienManager _TblThanhVienManager = new TblThanhVienManager();
    string hidID = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            string Tentruycap=Session[Constants.SessionTenDangNhap].ToString() ;
            if (!string.IsNullOrEmpty(Tentruycap))
            {
                DataTable _dt = (new TblThanhVienManager()).SelectByTenTruyCapRDT(Tentruycap);
                if (_dt != null && _dt.Rows.Count >0) lblUserFullName.Text = _dt.Rows[0][TblThanhVienFields.FullName.Name].ToString();
            }
            if (Session[Constants.SessionUserId] != null)
                hidID = Session[Constants.SessionUserId].ToString();
            else
            {
                HttpCookie _cookie = Request.Cookies["InfoLogin"];
                if (_cookie != null)
                {
                    string[] strInfo = _cookie.Value.Split(',');
                    if (strInfo.Length > 0)
                    {
                        DataTable _dtRole = _TblThanhVienManager.GetIDByUserName(strInfo[0]);
                        if (_dtRole.Rows.Count > 0)
                            hidID = _dtRole.Rows[0][0].ToString();
                    }
                }
            }
            lnkChangePass.NavigateUrl = "~/AdminPortal/Pages/ChangePass.aspx?id=" + hidID;
        }
    }
}